let oMath=document.querySelector('.Math-random')
var num=document.querySelector('#num')
var dtext=document.querySelector('#div-text')
let over=document.querySelector('.ver-img')
let disbtn=document.querySelector('#dis-btn')
let opd=document.querySelector('.op-div')
let oyear=document.querySelector('.in-year')
let oiname=document.querySelector('.in-name')
console.log(opd)
// ................随机数............
function rand(min,max) {
    return Math.floor(Math.random()*(max-min))+min;
}
var btn=document.getElementById("btn");
btn.onclick=function(){
    var randnum=rand(1000,9999);
    document.getElementById("num").innerHTML=randnum;
}
num.onclick=function(){
    var randnum=rand(1000,9999);
    num.style.background='write'
    document.getElementById("num").innerHTML=randnum;
}
// ..............当输入的数字和随机数不对，出现提示..........
dtext.addEventListener('change',function(){
    if(dtext.value!==num.innerHTML){
       over.style.display='block'
    }
    else{
        //  disbtn.remove('disabled')
        disbtn.style.color='black'
    }
    if(dtext.value==6666){
        over.style.display='none'
        disbtn.style.color='black'
    } 
})
$('.time-div').find('.in-year').click(function(){
    $('.op-div').toggle()
})
$('.time-div').find('.in-month').click(function(){
    $('.month-div').toggle()
})
$('.time-div').find('.in-day').click(function(){
    $('.day-div').toggle()
})
let otn=document.querySelector('.two-nine')
let otz=document.querySelector('.three-zero')
let oto=document.querySelector('.three-one')
let aop=document.querySelectorAll('.op-div>div') 
 console.log(otz)
aop.forEach(function(ele,index){
    // console.log(ele.innerHTML)
    ele.addEventListener('click',function(){
        oyear.value=ele.innerHTML
         var ale=oyear.value
         console.log(ale)
    if(ale % 4==0 && ale % 100 !== 0 || ale % 400 ==0){
        otz.style.style.display='none'
        otn.style.style.display='none'
        oto.style.style.display='none'
        console.log(otz.style.display)
    }
    })
})
let omon=document.querySelector('.in-month')
let amon=document.querySelectorAll('.month-div>div')
amon.forEach(function(ele,index){
    ele.addEventListener('click',function(){
        omon.value=ele.innerHTML
    })
})
let oday=document.querySelector('.in-day')
let aday=document.querySelectorAll('.day-div>div')
aday.forEach(function(ele,index){
    ele.addEventListener('click',function(){
        oday.value=ele.innerHTML
    })
})
let reword=/^\S{6,}$/
let obenum=document.querySelector('#re-word')
// console.log(obenum)
obenum.addEventListener('change',function(){
    console.log(this)
    if(reword.test(this.value)){
        // alert('对')
    }
})
console.log(oiname.value)
console.log(oiname)
let verphone=document.querySelector('.phone-ver')
let obeber=document.querySelector('.become-number')
obeber.addEventListener('click',function(){
    if(dtext.value==num.innerHTML||
        dtext.value==6666
     && verphone.value!==null 
     && oyear.value!==null 
     && omon.value!==null
      && oday.value!==null 
      && oiname.value!==''
      )
      {
        window.location.href='../index.html'
    }
    else{
        alert('错误')
    }
})
// console.log(aop.innerHTML)
// console.log($(op-div>div).text())